package biz.obake.team.touchprotector.lfd;

import android.content.Context;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.drawable.Drawable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import biz.obake.team.android.d;
import biz.obake.team.android.f;
import biz.obake.team.touchprotector.R;

public class g extends BaseAdapter {
    private static Bitmap e;
    /* access modifiers changed from: private */

    /* renamed from: b  reason: collision with root package name */
    public a f1751b;

    /* renamed from: c  reason: collision with root package name */
    private Context f1752c;
    /* access modifiers changed from: private */

    /* renamed from: d  reason: collision with root package name */
    public Resources f1753d;

    class a extends d {

        /* renamed from: d  reason: collision with root package name */
        final /* synthetic */ int f1754d;

        /* JADX INFO: super call moved to the top of the method (can break code semantics) */
        a(Bitmap bitmap, int i) {
            super(bitmap);
            this.f1754d = i;
        }

        /* access modifiers changed from: protected */
        public Drawable c() {
            f fVar = new f(g.this.f1753d, (int) g.this.f1753d.getDimension(R.dimen.lock_frame_design_thumbnail_size), (int) g.this.f1753d.getDimension(R.dimen.lock_frame_design_thumbnail_size));
            fVar.d(g.this.f1751b.b(this.f1754d));
            return fVar.c();
        }
    }

    public g(a aVar) {
        this.f1751b = aVar;
        biz.obake.team.android.a a2 = biz.obake.team.android.a.a();
        this.f1752c = a2;
        this.f1753d = a2.getResources();
    }

    private static Bitmap c() {
        if (e == null) {
            e = BitmapFactory.decodeResource(biz.obake.team.android.a.a().getResources(), R.drawable.lock_frame_0);
        }
        return e;
    }

    public int getCount() {
        return this.f1751b.getCount();
    }

    public Object getItem(int i) {
        return null;
    }

    public long getItemId(int i) {
        return 0;
    }

    public View getView(int i, View view, ViewGroup viewGroup) {
        if (view == null) {
            view = LayoutInflater.from(this.f1752c).inflate(R.layout.lfd_gridview_item, (ViewGroup) null);
        }
        TextView textView = (TextView) view.findViewById(R.id.lock_frame_design_title);
        a aVar = new a(c(), i);
        aVar.d();
        ((ImageView) view.findViewById(R.id.lock_frame_design_image)).setImageDrawable(aVar);
        textView.setText(this.f1751b.c(i));
        textView.setBackgroundResource(this.f1751b.a(i).equals(f.d().e()) ? R.drawable.gridviewitem_selected_bg : R.drawable.gridviewitem_bg);
        return view;
    }
}
